/*
 * ServerManager.java
 *
 * $Id: ServerManager.java,v 1.10 2009-10-07 10:19:39 juancarlos Exp $
 */
package org.ceteca.explica.server;

import org.ceteca.explica.core.InterfaceExplica;
import org.ceteca.explica.server.common.CommonManagerBuilder;
import org.ceteca.explica.server.installer.UpdateManager;
import org.ceteca.explica.server.management.ManagementManagerBuilder;
import org.ceteca.explica.server.warehouse.WarehouseManagerBuilder;

/**
 * Implements the main class of the server side of the application.
 * <br/>
 * Responsibilities:
 * <ul>
 *  <li>Start the server of the Explica application.</li>
 * </ul>
 * @author Mario García García <mario@imagos.es>
 * Copyright (c) 2008 Fundación Centro Tecnolóxico da Carne
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <br/>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <br/>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
public class ServerManager {
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// Init the server context with the generic objects that will be used by the
		// server instances.
		ServerContext.getInstance().initServerContext();
		
		ServerContext.getInstance().getLogger(InterfaceExplica.EXPLICA_LOG_CATEGORY).
				info("Server application started");
		
		// Init the installer server
		UpdateManager.getInstance().initInstaller();

		// Init the common manager server
		CommonManagerBuilder.initCommonManager();
		
		// Init the warehouse manager server
		WarehouseManagerBuilder.initWarehouseManager();
		
		
		
		// Init the clients manager server
		//PartnersManagerBuilder.initPartnersManager();
		
		//Init the management manager server
		ManagementManagerBuilder.initManagementManager();
		
		// Start Hibernate (This method loads the mapping resource files, so
		// the next queries will be quicker)
/*		Session session = HibernateUtil.getSessionFactory().openSession();
		session.close();
*/
		
		System.out.println("FIN DE LA PUESTA EN MARCHA DEL SERVIDOR!");
	}

	/**
     * Devuelve el tag Id de CVS asociado al fuente del fichero.
     */
    public static String getRevision() {
        return "$Id: ServerManager.java,v 1.10 2009-10-07 10:19:39 juancarlos Exp $";
    }
}
